extends NodeState

@export var igorBoss: IgorBoss



func _on_process(_delta : float) -> void:
	process_coillder()



func _on_enter() -> void:
	# 进入状态时打开监听，允许发生碰撞
	igorBoss.damageEmitter.set_deferred("monitoring", true)
	process_animation()



func _on_exit() -> void:
	# 退出状态时关闭监听，停止发生碰撞
	igorBoss.damageEmitter.set_deferred("monitoring", false)


func process_animation():
	igorBoss.animationPlayer.play(IgorBoss.ANIMATION_KICK)


func process_coillder():
	var orientation = igorBoss.character_orientation()
	if orientation > 0:
		igorBoss.damageEmitter.scale.x = 1
	elif orientation < 0:
		igorBoss.damageEmitter.scale.x = -1


func on_kick_animation_finished():
	transition_state(IgorBoss.STATE_IDLE)
